FROM ubuntu:14.04

MAINTAINER Jaren jlin@archos.com

#
# update hosts
#
ADD sources.list /etc/apt/sources.list

#
# apt-get update & install
#
RUN apt-get update || true
RUN apt-get install -y \
	openssh-server \
	squid3 

#
# ssh-server
#
RUN mkdir /var/run/sshd
RUN echo 'root:123456' | chpasswd
RUN sed -i 's/^PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config

# SSH login fix. Otherwise user is kicked off after login
RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd

ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile

#
# Squid
#
ADD squid.conf /etc/squid3/squid.conf

#
# Update hosts tool
#
# Want to modify hosts to visit google, but fail, squid show "Read Error"
#ADD get_newhosts.sh /get_newhosts.sh

#
# Setup
#
ADD setup.sh /setup.sh

#
# ENTRYPOINT
#
ENTRYPOINT bash /setup.sh && bash
